﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JoyTalq.Core.Bus.Persistence;
using JoyTalq.Core.Bus.Domain;

namespace JoyTalq.Core.Bus.Service.Impl
{
    public class BusService : IBusService
    {
        public IBusDao BusDao { get; set; }

        /// <summary>
        /// 取得公車站牌資訊 By 站牌代碼
        /// </summary>
        /// <param name="stopId">站牌代碼</param>
        /// <returns>公車站牌資訊</returns>
        public StopVO GetStopById(string stopId)
        {
            return BusDao.GetStopById(stopId);
        }

        /// <summary>
        /// 取得全部的公車站牌資訊清單
        /// </summary>
        /// <returns>全部的公車站牌資訊清單</returns>
        public IList<StopVO> GetAllStopList()
        {
            return BusDao.GetAllStopList();
        }

        /// <summary>
        /// 取得全部的公車站牌資訊清單
        /// </summary>
        /// <param name="pageIndex">分頁索引</param>
        /// <param name="pageSize">分頁大小</param>
        /// <param name="sortField">排序欄位</param>
        /// <param name="sortDesc">升降冪排序</param>
        /// <returns>全部的公車站牌資訊清單</returns>
        public IList<StopVO> GetAllStopList(int pageIndex, int pageSize, string sortField, bool sortDesc)
        {
            if (string.IsNullOrEmpty(sortField))
            {
                return BusDao.GetAllStopList(pageIndex, pageSize);
            }

            return BusDao.GetAllStopList(pageIndex, pageSize, sortField, sortDesc);
        }
    }
}
